import { getCityList } from "../api";
import { defineStore } from "pinia";
import {RootObject,Children,ChinaAdd,ChinaTotal,StatisGradeCityDetail} from './getlistType'
const enum  Name  {
  cityList='cityList'
}

export  const useCityList = defineStore(Name.cityList,{
  state:()=>{
    return {
      list:<RootObject>{},
      item:<Children[]>[],
      chinaAdd:<ChinaAdd>{},
      chinaTotal:<ChinaTotal>{},
      statisGradeCityDetail:<StatisGradeCityDetail[]>[]
    }
  },
  actions:{
     async getList() {
   
      
      let result = await getCityList()
        
        
        this.$state.list  = result.data
        this.$state.chinaAdd  = result.data.diseaseh5Shelf.chinaAdd
        this.$state.chinaTotal  = result.data.diseaseh5Shelf.chinaTotal
        //饼图数据
        this.$state.statisGradeCityDetail = result.data.statisGradeCityDetail.slice(0,10)
    }
  }
})